<!--
 * @Author: HeAo
 * @Date: 2021-10-12 09:30:39
 * @LastEditTime: 2021-10-12 09:30:40
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2105\3-2-Vue\day04\1-具名插槽.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="app">
    <my-com>
      <!-- 填充name:header具名插槽 -->
      <template v-slot:header>
        <h3>我是header</h3>
      </template>
      <!-- 填充默认插槽 -->
      <!-- <h4>我是main</h4> -->
      <template v-slot:default>
        <h4>我是main</h4>
      </template>
      <!-- 填充name:footer的具名插槽 -->
      <template v-slot:footer>
        <h5>我是footer</h5>
      </template>
    </my-com>
  </div>
  <script>
    let component1 = {
      data() {
        return {

        }
      },
      template: `
        <div>
          <header><slot name="header"></slot></header>
          <main><slot name="default"></slot></main>
          <footer><slot name="footer"></slot></footer>
        </div>
      `
    }

    let vm = new Vue({
      el: '#app',
      data: {},
      methods: {},
      components: {
        myCom: component1
      }
    })
  </script>
</body>

</html>